<?php
require '../../base.php';
require '../../msg/MessageStatic.class.php';

if (!defined('DP_BASE_DIR')){
	die(MessageStatic::$notAccessMessage);
}

require DP_BASE_DIR .'/base/db/DBConnection.class.php';
require DP_BASE_DIR .'/base/db/CommonDAO.class.php';
require DP_BASE_DIR .'/integration/roe/SelectAppByLCROE.class.php';

$idLC = $_GET['lc'];

if (is_null($idLC)){
	header('Refresh: 0; ' . $urlApp .'/presentation/app/selectLCToApply.php');
}

$db=DBConnection::getInstance();
$selectAppByLCROE = new SelectAppByLCROE($db);

$result = $selectAppByLCROE->getStmtByLC($idLC);
$stTblResults = '';
if (($result)||(mysql_errno == 0))
{
	$stTblResults = "<table width='100%' border='1'  cellspacing='0' cellpadding='0'> <tr> ";
	if (mysql_num_rows($result)>0)
	{
		//loop thru the field names to print the correct headers
		$i = 0;
		$stTblResults = $stTblResults. "<th class='tituloTabla'> ID </th>";
		while ($i < mysql_num_fields($result))
		{
			$stTblResults = $stTblResults. "<th class='tituloTabla'>". mysql_field_name($result, $i) . "</th>";
			$i++;
		}
		$stTblResults = $stTblResults. "</tr>";
		 
		//display the data
		$intCount = 1;
		while ($rows = mysql_fetch_array($result,MYSQL_ASSOC))
		{
			$stTblResults = $stTblResults .  "<tr>";
			$stTblResults = $stTblResults .  "<td align='center' class='componenteFormulario'>". $intCount. "</td>";
			$intCount = $intCount + 1;
			foreach ($rows as $data)
			{
				$stTblResults = $stTblResults .  "<td align='center' class='componenteFormulario'>". $data . "</td>";
			}
		}
	}else{
		$stTblResults = $stTblResults .  "<tr><td colspan='" . ($i+1) . "'>No Results found!</td></tr>";
	}
	$stTblResults = $stTblResults .  "</table>";
}else{
	$stTblResults = $stTblResults .  "Error in running query :". mysql_error();
}
?>

<html>

	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF8" />
		<link type="text/css" rel="stylesheet" href="../css/standalone.css" />
		<link type="text/css" rel="stylesheet" href="../css/estilo.css" />
		<link type="text/css" rel="stylesheet" href="../css/scrollable-wizard.css" />
		<title>Select Applicants by LC Results</title>
	</head>
	
	<body>
	
		<p>This is a temporal page, the objetive is give this information in a
		csv File but for now this process is under development, please by
		paytiend !!! and use this temporally tanks NIMT COLOMBIA TEAM - APLICA2.0</p>
		<table border="1" width="46%" cellspacing="0" cellpadding="0">
			<tr class="tituloTabla">
				<td width="123">Local Committee</td>
				<td>&nbsp;</td>
			</tr>
		</table>
		<br></br>
		<!-- in this part put the php generate table with the information with applicants by lc -->
		<?php echo $stTblResults; ?>
	</body>

</html>


